Skip to content

Refactor: extract pure-logic base classes to prepare for async implementation#167

Open
abelmilash-msft wants to merge 1 commit into
mainfrom
users/abelmilash/async-phase1-shared-base
Open

Refactor: extract pure-logic base classes to prepare for async implementation#167
abelmilash-msft wants to merge 1 commit into
mainfrom
users/abelmilash/async-phase1-shared-base

Conversation

@abelmilash-msft
Copy link
Copy Markdown
Contributor

Summary

Extracts pure logic (URL building, payload construction, parsing, caches, multipart serialization) from the sync clients into shared base classes _ODataBase and _BatchBase. The sync clients now inherit from these bases. The async client (Phase 2) will inherit from the same bases as a sibling, enabling code sharing without the async client being a subtype of the sync client.

  • _ODataBase — pure logic extracted from _ODataClient; owns cache teardown and HTTP logger lifecycle via close()
  • _BatchBase — pure logic extracted from _BatchClient; owns multipart serialization and response parsing

Tests

1369 passed
Total coverage: 94.35% (threshold: 90%)

Copilot AI review requested due to automatic review settings April 24, 2026 18:45
@abelmilash-msft abelmilash-msft requested a review from a team as a code owner April 24, 2026 18:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Extracts shared, I/O-free logic from the sync Dataverse OData and batch clients into new base classes to enable upcoming async client implementation while reducing duplication.

Changes:

  • Added _ODataBase with URL/payload builders, caches, SQL guardrails, and lifecycle teardown.
  • Added _BatchBase with batch intent types plus multipart serialization/response parsing utilities.
  • Updated _ODataClient and _BatchClient to inherit from the new base classes and adjusted a unit test patch target accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/data/test_sql_parse.py Updates patch target to match the new urlparse location in _odata_base.
src/PowerPlatform/Dataverse/data/_odata_base.py Introduces _ODataBase and shared helpers formerly in _odata.py.
src/PowerPlatform/Dataverse/data/_odata.py Refactors _ODataClient to inherit shared “pure logic” from _ODataBase.
src/PowerPlatform/Dataverse/data/_batch_base.py Introduces _BatchBase and moves intent types + multipart logic out of _batch.py.
src/PowerPlatform/Dataverse/data/_batch.py Refactors _BatchClient to inherit batch serialization/parsing from _BatchBase.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PowerPlatform/Dataverse/data/_odata_base.py
Comment thread src/PowerPlatform/Dataverse/data/_odata_base.py
Comment thread src/PowerPlatform/Dataverse/data/_odata_base.py
vrathee-msft
vrathee-msft previously approved these changes May 6, 2026
@abelmilash-msft abelmilash-msft force-pushed the users/abelmilash/async-phase1-shared-base branch 3 times, most recently from f84ec5e to a83a688 Compare May 15, 2026 05:44
@abelmilash-msft abelmilash-msft force-pushed the users/abelmilash/async-phase1-shared-base branch from a83a688 to a2f5f7d Compare May 18, 2026 16:31
- Reset to main (which is now PR #175)
- Re-apply: _ODataBase, _BatchBase, _QueryBuilderBase, _BatchContext Protocol,
  _operation_context in base, Self type annotation
- Re-export multipart helpers from _batch.py for test compatibility
- Update test_sql_parse.py patch target to _odata_base.urlparse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@abelmilash-msft abelmilash-msft force-pushed the users/abelmilash/async-phase1-shared-base branch from a2f5f7d to e7df299 Compare May 18, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants